#=
符号求导
=#


using Symbolics


function run()
    @variables dB, h2m
    @variables r0x, r0y, r0z
    @variables ηx, ηy, ηz
    r0ij = [r0x, r0y, r0z]
    ηij = [ηx, ηy, ηz]
    absr0ij = sqrt(sum(r0ij.^2))
    println(absr0ij)
    #
    ther = sqrt(2π*h2m*dB)
    println(ther)
    rij = r0ij + ηij*ther
    println(rij)
    absrij = sqrt(sum(rij.^2))
    println(absrij)
    #
    ∂r_∂b = Symbolics.derivative(absrij, dB)
    println(∂r_∂b)
    #(
    #(12.566370614359172h2m*ηx*(r0x + ηx*sqrt(6.283185307179586dB*h2m))) / (2sqrt(6.283185307179586dB*h2m)) 
    #+(12.566370614359172h2m*ηy*(r0y + ηy*sqrt(6.283185307179586dB*h2m))) / (2sqrt(6.283185307179586dB*h2m)) 
    #+(12.566370614359172h2m*ηz*(r0z + ηz*sqrt(6.283185307179586dB*h2m))) / (2sqrt(6.283185307179586dB*h2m))
    #) / 
    #( 2 sqrt(
    #(r0x + ηx*sqrt(6.283185307179586dB*h2m))^2 
    #+ (r0y + ηy*sqrt(6.283185307179586dB*h2m))^2
    # + (r0z + ηz*sqrt(6.283185307179586dB*h2m))^2
    #))
    # -> 4π h^2/m <η|r> / 2 sqrt(2π*dB*h2/m) / 2 |r|
    # -> 2π h^2/m <η|r> / sqrt(2π*dB*h2/m) / 2 |r|
    # -> sqrt(2π*h2/m) <η|r> / dB* 2 |r|
    # -> <y|r> / (dB*2|r|)
end


run()

